<%@ page language="java" errorPage="/error.jsp" pageEncoding="utf-8" contentType="text/html;charset=utf-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ page language="java" import="com.fish.anne.service.SystemRegionManager" import="org.springframework.web.context.support.WebApplicationContextUtils"
import="org.springframework.context.ApplicationContext" 
import="com.fish.anne.model.SystemRegion"   isErrorPage="true"
import="java.util.List"  %>

<%

ApplicationContext ctx =
            WebApplicationContextUtils.getRequiredWebApplicationContext(request.getSession().getServletContext());
SystemRegionManager ssm = (SystemRegionManager)ctx.getBean("systemRegionManager");

List<SystemRegion> systemRegions = ssm.getAll();
	
request.setAttribute("systemRegions",systemRegions);

 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>
			
		</title>
		
		<%@ include file="/jsp/front/common/header.jsp"%>
		<script type="text/javascript" src="scripts/jqgrid/jquery-1.4.2.js"></script>
		<script type="text/javascript" src="scripts/jqgrid/MyGrid.js"></script>
		
		
<script type="text/javascript">
	
	

	




	
</script>


<script type="text/javascript">


jQuery(function(){
jQuery( "button, input:button, a", ".demo" ).button();
$( "a", ".demo" ).click(function() { return false; });
	var lastsel;

var listGrid="#list1"; 
var list1=new MyGrid(listGrid,{
    caption: "数据列表",
    url:'front/getAllOrder2.do',
	postData:{},//date1:'2010-09-29'
   	colNames:['id','订单金额', '起始时间', '结束时间','订单状态','订单创建时间'],
   	colModel:[
	    {name:'id',index:'id', width:100, hidden:true,sorttype:"string"},
   		{name:'total_amount',index:'total_amount', width:100, sorttype:"int",editable:true},
   		{name:'start_date',index:'start_date', width:200,sorttype:"string",editable:true},
		{name:'end_date',index:'end_date', width:200,sorttype:"string",editable:true},
		{name:'status',index:'status', width:200,sorttype:"string",editable:true},
		{name:'create_time',index:'create_time', width:200,sorttype:"string",editable:true}
   	],
	/*
	ondblClickRow: function(id){ 
	list1.jqGrid('setGridParam',{editurl:"jqGridServlet?_sql=updateSql"});
		if(id && id!==lastsel){ 
			jQuery('#list1').jqGrid('restoreRow',lastsel); 
			jQuery('#list1').jqGrid('editRow',id,true); 
			lastsel=id; 
			} 
	},  
	*/
	height:250,
	width:680,
	 
   	pager: jQuery('#plist1')
		}
	
	);
	
	
	jQuery("#button_del").click( function() { 
    var selrow=list1.jqGrid('getGridParam','selrow');
	if(selrow==null){
		alert('请选择一行数据');
		return ;
	}
	list1.jqGrid('setGridParam',{editurl:"front/getAllOrder2.do"}); 
	list1.jqGrid('delGridRow',selrow,{reloadAfterSubmit:true}); 

	});
	
jQuery("#button_add").click(function(){ 
	list1.jqGrid('setGridParam',{editurl:"jqGridServlet?_sql=addSql"}); 
	list1.jqGrid('editGridRow',"new",{height:280,reloadAfterSubmit:false}); 
	}); 
	
jQuery("#button_edit").click( function() { 
    var selrow=list1.jqGrid('getGridParam','selrow');
	if(selrow==null){
		alert('请选择一行数据');
		return ;
	}
	list1.jqGrid('setGridParam',{editurl:"jqGridServlet?_sql=updateSql"}); 
	list1.jqGrid('editRow',selrow); 
	this.disabled = 'true'; 
	jQuery("#button_save,#button_cancel").attr("disabled",false); 
	}); 
	
	
jQuery("#button_save").click( function() { 
	list1.jqGrid('saveRow',list1.jqGrid('getGridParam','selrow'),checksave); 
	jQuery("#button_save,#button_cancel").attr("disabled",true); 
	jQuery("#button_edit").attr("disabled",false); 
	}); 
jQuery("#button_cancel").click( function() { 
	list1.jqGrid('restoreRow',list1.jqGrid('getGridParam','selrow')); 
	jQuery("#button_save,#button_cancel").attr("disabled",true); 
	jQuery("#button_edit").attr("disabled",false); 
	});
	
	jQuery("#button_pay").click( function() { 
    var selrow=list1.jqGrid('getGridParam','selrow');
	if(selrow==null){
		alert('请选择一行数据');
		return ;
	}
	
	window.location.href = 'order_pay.do?orderId='+selrow;
	});
	
	
});

 
	
function checksave(result) { 
var obj=eval('(' + result.responseText + ')'); 
//alert(obj.status);
if(obj.status=='success')
	return true; 
else{
	alert(obj.msg);
	return false;
}
} 




</script>


	</head>
	<body>
		<%@ include file="/jsp/front/common/nav.jsp"%>
		<div class="container">
			<div class="leftBar">
				
					
				
				<div class="t_block helpct">
					<div class="hd">
						<div class="wrap">
							用户管理
						</div>
					</div>
					<div class="ct">
						<ul>
							<li>
								<a href="driveSelfOrder.jsp">订单管理</a>
							</li>
							<li>
								<a href="changePassword.jsp">密码修改</a>
							</li>
						</ul>
					</div>
				</div>
				
			</div>
			
			
			<div class="content">
				
				 

				<div>
					<table id="list1"></table>
					<div id="plist1"></div>	
					<div class="demo">
						<input type="button" id="button_del" value="删除" />
						<input type="button" id="button_pay" value="缴费" />
					</div>
				</div>
			</div>
		</div>

		


<script type="text/javascript">
    	
            function QueryString(val){
            	var uri = window.location.search;
            	var re = new RegExp("" +val+ "=([^&?]*)", "ig");
            	return ((uri.match(re))?(uri.match(re)[0].substr(val.length+1)):null);
            }
            
            try{
            	var page = parent.ttsHeader || QueryString("page"); 
            } catch(e) {
            	var page = QueryString("page");
            } 
            
            switch(page){
            	case "home" :
            		setActive("home");
            		break;
            	case "flight" :
            		setActive("flight");
            		break;
            	case "inter" :
            		setActive("inter");
            		break;
            	case "help" :
            		setActive("help");
            		break;
            	case "about" :
            		setActive("about");
            		break;
            	case "order" :
            		setActive("order");
            		break;
            	default :
            		break;
            }
            function setActive(id){
                if ( document.getElementById("nav_" + id) ) {
                    document.getElementById("nav_" + id).className = "active";
                }            	
            } 
        </script>


	</body>
</html>